<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
	<style>
		textarea {
			width: 100%;
			height: 50px;
		}
	</style>
</head>

<body>
	<div style="display: none;" id="b">
		<resources xmlns:tools="http://schemas.android.com/tools">
			<string name="app_name">棉花糖</string>
			<string name="paper">纸币 ¥：</string>
		</resources>
	</div>

	<div id="vue">
		<div v-for="(v,k) in o" :key="k" :id="k">
			<div v-text="v"></div>
		</div>
	</div>

	<textarea id="a" placeholder="请输入strings.xml中的代码"></textarea>

	<button id="bb">生成</button>

	<script src="/scriptZIP/vue.min.js"></script>
	<script>
		var app = new Vue({
			el: '#vue',
			data: {
				o: {}
			},
		});

		var a = document.getElementById('a');
		a.onchange = function () {
			document.getElementById('b').innerHTML = a.value;
			let oo = {};
			for (let o of document.querySelectorAll('string')) {
				oo[o.getAttribute('name')] = o.innerText;
			}
			app.o = oo;
		}

		document.getElementById('bb').onclick = function () {
			var o = {};
			Object.keys(app.o).forEach(it => {
				o[it] = document.getElementById(it).innerText;
			});
			for (let e of document.querySelectorAll('string')) {
				e.innerText = o[e.getAttribute('name')]
			}

			console.log(document.getElementById('b').innerHTML.replace(/ _mst\w+="\w+"/g, ''));
		}





	</script>

</body>

</html>